package edu.hrbu.wsdemo.controller;

import edu.hrbu.wsdemo.bean.Message;
import edu.hrbu.wsdemo.service.NotificationService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author xudengyu
 */
@RestController
@RequestMapping("/api")
public class NotificationController {

    @Resource
    private NotificationService notificationService;

    @PostMapping("/send")
    public ResponseEntity<String> sendNotification(@RequestBody Message message) {
        notificationService.sendNotification(message);
        return ResponseEntity.ok("消息已发送");
    }
}
